home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / kerberos / pc / krb_libk.lha / Lib / KRB / UTIL.C < prev   
Encoding:
C/C++ Source or Header  |  1991-05-31  |  1.9 KB  |  81 lines

  1. /*
  2.  * $Source: /mit/kerberos/src/lib/krb/RCS/util.c,v $
  3.  * $Author: wesommer $
  4.  *
  5.  * Copyright 1988 by the Massachusetts Institute of Technology.
  6.  *
  7.  * For copying and distribution information, please see the file
  8.  * <mit-copyright.h>.
  9.  *
  10.  * Miscellaneous debug printing utilities
  11.  */
  12.  
  13. #if 0 /* Problematic code -- Peter */
  14.  
  15. #ifndef    lint
  16. static char rcsid_util_c[] =
  17. "$Header: util.c,v 4.8 89/01/17 22:02:08 wesommer Exp $";
  18. #endif    lint
  19.  
  20. #include <mit_copy.h>
  21. #include <krb.h>
  22. #include <des.h>
  23. #include <sys\types.h>
  24. #include <netinet\in.h> 
  25. /* #include <arpa\inet.h> */  /* in.h and inet.h contradict */
  26. #include <stdio.h>
  27.  
  28. /*
  29.  * Print some of the contents of the given authenticator structure
  30.  * (AUTH_DAT defined in "krb.h").  Fields printed are:
  31.  *
  32.  * pname, pinst, prealm, netaddr, flags, cksum, timestamp, session
  33.  */
  34.  
  35. ad_print(x)
  36.     AUTH_DAT *x;
  37. {
  38. #ifndef lint
  39.     /*
  40.      * Print the contents of an auth_dat struct.  We can't cast a char
  41.      * array (x->address) to a struct in_addr, so we must turn off
  42.      * lint checking here.
  43.      */
  44.     printf("\n%s %s %s %s flags %u cksum 0x%X\n\ttkt_tm 0x%X sess_key",
  45.            x->pname, x->pinst, x->prealm,
  46.            inet_ntoa(x->address), x->k_flags,
  47.            x->checksum, x->time_sec);
  48. #endif /* lint */
  49.     printf("[8] =");
  50. #ifdef NOENCRYPTION
  51.     placebo_cblock_print(x->session);
  52. #else /* Do Encryption */
  53.     des_cblock_print_file(x->session,stdout);
  54. #endif /* NOENCRYPTION */
  55.     /* skip reply for now */
  56. }
  57.  
  58. #ifdef NOENCRYPTION
  59. /*
  60.  * Print in hex the 8 bytes of the given session key.
  61.  *
  62.  * Printed format is:  " 0x { x, x, x, x, x, x, x, x }"
  63.  */
  64.  
  65. placebo_cblock_print(x)
  66.     des_cblock x;
  67. {
  68.     unsigned char *y = (unsigned char *) x;
  69.     register int i = 0;
  70.  
  71.     printf(" 0x { ");
  72.  
  73.     while (i++ <8) {
  74.         printf("%x",*y++);
  75.         if (i<8) printf(", ");
  76.     }
  77.     printf(" }");
  78. }
  79. #endif /* NOENCRYPTION */
  80. #endif
  81.